@extends('admin.container')

@section('c-foot')
        <!-- 配置文件 -->
<script type="text/javascript" src="/assets/b2b/admin/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/assets/b2b/admin/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>
@stop

@section('c-body')
    <div class="am-g">
        <div class="am-u-md-12">
            @if(count($errors) > 0)
                @foreach ($errors->all() as $error)
                    <div class="am-alert am-alert-warning" data-am-alert>
                        <button type="button" class="am-close">&times;</button>
                        <p>{{ $error }}</p>
                    </div>
                @endforeach
            @endif
        </div>
    </div>
    <div class="am-g">
        <div class="am-u-md-12">
            <form class="am-form" action="{{ route('admin.article.update', [$target->id]) }}" method="POST">
                {{ csrf_field() }}
                <input type="hidden" name="_method" value="PUT">
                <div class="am-form-group">
                    <div class="am-g">
                        <div class="am-u-md-6">
                            <label class="am-form-label">文章标题</label>
                            <input class="am-form-field" name="title" type="text" placeholder="请输入标题" value="{{ old('title', $target->title) }}">
                        </div>
                        <div class="am-u-md-3">
                            <label class="am-form-label">文章分类</label>
                            <select class="am-form-field" name="category_id" value="{{ old('category_id', $target->category_id) }}">
                                @include('admin.site.category.category-list', ['categories' => $categories, 'level' => 0, 'select' => $target->category_id])
                            </select>
                        </div>
                        <div class="am-u-md-3">
                            <label class="am-form-label">文章排序</label>
                            <input class="am-form-field" name="sort" type="number" value="{{ old('sort', $target->sort) }}">
                        </div>
                    </div>
                </div>
                <div class="am-form-group">
                    <label class="am-form-label">文章链接</label>
                    <input class="am-form-field" name="href" type="text" placeholder="填写文章地址，对于一些外链文章可使用该项。可为空。" value="{{ old('href', $target->href) }}">
                </div>
                <div class="am-form-group">
                    <script id="container" name="content" type="text/plain">{!! old('content', $target->content) !!}</script>
                </div>
                <div class="am-form-group">
                    <label class="am-form-label">是否可见</label>
                    <div class="am-g">
                        <div class="am-u-md-12">
                            <label class="am-radio-inline">
                                <input type="radio"  value="1" name="display" checked> 是
                            </label>
                            <label class="am-radio-inline">
                                <input type="radio" value="0" name="display"> 否
                            </label>
                        </div>
                    </div>
                </div>

                <button type="submit" class="am-btn am-btn-primary">保存修改</button>
            </form>
        </div>
    </div>
@stop